package com.weight.common.generate.temple;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

import com.weight.common.generate.base.CommonUtil;
import com.weight.common.generate.base.JavaFile;

/**
* 
*  
*/
public class MapperInterfaceFile extends JavaFile {
	private String model;
	public MapperInterfaceFile(String filePath, String mainPackage, String curPackage, String model,String tableCnName,List<String> fieldENList) {
		super(filePath, getClassName(model).append(".java").toString(), mainPackage+"."+curPackage, INTERFACE_TYPE, getClassName(model).toString());
		this.model = model;
		
		List<String> imports = new LinkedList<String>();
		List<String> classAnnotations = new LinkedList<String>();
		List<String> extendsList = new LinkedList<String>();
		List<String> importPackagePaths = new LinkedList<String>();
		List<JavaFile.Field> fieldLists = new LinkedList<Field>();
		List<Method> methodLists = new LinkedList<Method>();
		//imports
		imports.add(getImportName(mainPackage, model).toString());
		imports.add("java.util.List");
		imports.add("java.util.Map");
		CommonUtil.insertMethod(methodLists,model,tableCnName,false,false,fieldENList);
		/**	类注释	*/
		Collection<String> classDescriptionList=CommonUtil.descriptionModel(new StringBuilder(tableCnName), null, false);
		super.init(imports, classAnnotations, extendsList, importPackagePaths, fieldLists, methodLists,classDescriptionList);
	}
	public static StringBuilder getClassName(String model) {
		StringBuilder className = new StringBuilder();
		className.append(getModelClass(model));
		className.append("Mapper");
		return className;
	}
}
